package graphics;

import java.awt.Graphics;
import java.util.StringTokenizer;


public class Cerchio implements Forma{

	private int x,y,r;
	
	public void draw(Graphics graphics) {
		graphics.drawOval(x-r, y-r, 2*r, 2*r);
	}
	
	public void readFromString(String s) {
		
		StringTokenizer tok=new StringTokenizer(s," :");
		tok.nextToken();//Rettangolo
		tok.nextToken();//stringa x
		x=new Integer(tok.nextToken());
		tok.nextToken();//stringa y
		y=new Integer(tok.nextToken());
		tok.nextToken();//stringa r
		r=new Integer(tok.nextToken());
	}
	
	public String writeAsString() {
		return "Cerchio x:"+x+" y:"+y+" r:"+r;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public int getR() {
		return r;
	}

	public void setR(int r) {
		this.r = r;
	}
	
	
}
